import requests


class Authentication(object):

    @staticmethod
    def real_name_authentication(idNo, name):

        host = 'https://idenauthen.market.alicloudapi.com/idenAuthentication'
        AppCode = "7fd65282ea624c458959d3a26e25ebc5"  # AppCode只有购买后才能获得
        headers = {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Authorization": 'APPCODE ' + AppCode}

        # 上传的姓名和身份证号
        bodys = {}
        bodys['idNo'] = idNo
        bodys['name'] = name

        # res是一个对象
        res = requests.post(host, data=bodys, headers=headers)

        if res.status_code != 200:
            return None

        print(res.text)
        return res.text  # 把用户身份信息返回